package
{
	public class MolObject
	{
		public static const Root:* = undefined;
		
		public var Name:String = "";
		//public var idNum:uint;
		public var Parent:* = void;
		private var Children:Array;
		
		public function MolObject():void {
			Children = new Array();
		}
		
		public function getOrMake(id:String):MolObject {
			for each (var c:MolObject in Children) {
				if (id == c.Name) return c;
			}
			var fresh:MolObject = new this();
			fresh.Name = id;
			addChild(fresh);
			return fresh;
		}
		
		public function addChild(c:MolObject):void {
			c.Parent = this;
			Children.push(c);
		}
		
		public function getParent():MolObject {
			return Parent;
		}
		
		public function Print():void {
			if (Children.length != 0) {
				for each (var c:MolObject in Children) c.Print();
			} else {
				np.debug.print(Name);
			}
		}
	}
}